clear all
set mem 30m

use "/Users/gwf25/Dropbox/research/religion/final code/religion_all.dta"

//  Begin definition of variables

***Drop subjects who thought the experiment was about religion
gen id = _n
drop if id == 98 | id == 176 | id == 194 | id == 383

***Drop subjects who incorrectly completed the priming task. This includes subjects who leave more than half the responses blank. The following subjects
***all left at least questions #2-#7 blank in the sentence unscrambling task. 
drop if id==7 | id==719 | id==740 | id==762 | id==940

***An error led to some subjects seeing both the control and religion salient sentence unscrambling tasks. Here, we drop those subjects.
drop if prime_diff == 1

***"skipped" is a dummy variable for whether subjects skip the question that asks their religion. If they skip this question, we drop them from the sample 
***and if not, we assign a dummy variable to indicate the treatment group (religion salient or control) that subject belongs to.
gen skipped=0
replace skipped=1 if  s10q15==""
gen treatR=.
replace treatR=religion if skipped==0
drop if skipped==1

***Define religion
gen relig=.

***Note: 1 = protestant or other christian, 2 = catholic, 3 = jewish, 4 = agnostic/atheist
replace relig=1 if (s10q15=="Christian - Other (please specify below)" | s10q15=="Christian - Protestant (please specify denomination below)")
replace relig=2 if s10q15=="Christian - Catholic"
replace relig=3 if s10q15=="Jewish (Orthodox/Reformed/etc.)" | s10q15=="Jewish (Orthodox/Reform/etc.)"
replace relig=4 if (s10q15=="Agnostic" | s10q15=="Atheist")

***Drop Mormon/Othodox Christians from the sample
drop if s10q15sp == "Greek Orthodox"
drop if s10q15sp == "Russian Othrodox"
drop if s10q15sp == "greek orthodox"
drop if s10q15sp == "Orthodox Christian"
drop if s10q15sp == "Greek Orthdox"
drop if s10q15sp == "christian orthodox"
drop if s10q15sp == "Greek Orthodox Christian"
drop if s10q15sp == "Russian orthodox"
drop if s10q15sp == "Church of Jesus Christ of Latter Day Saints"
drop if s10q15sp == "Greek Orthodox"

// End of variables

***Panel A
rename s6 contribute
rename s6exp expect

reg contribute treatR if relig == 1, r
reg contribute treatR if relig == 2, r

***Panel B
reg expect treatR if relig == 1, r
reg expect treatR if relig == 2, r

***Panel C
reg contribute treatR expect if relig == 1, r
reg contribute treatR expect if relig == 2, r

clear all
set mem 30m
set more off

use "/Users/gwf25/Dropbox/research/religion/final code/religion_all.dta"

//  Begin definition of variables

***Drop subjects who thought the experiment was about religion
gen id = _n
drop if id == 98 | id == 176 | id == 194 | id == 383

***Drop subjects who incorrectly completed the priming task. This includes subjects who leave more than half the responses blank. The following subjects
***all left at least questions #2-#7 blank in the sentence unscrambling task. 
drop if id==7 | id==719 | id==740 | id==762 | id==940

***An error led to some subjects seeing both the control and religion salient sentence unscrambling tasks. Here, we drop those subjects.
drop if prime_diff == 1

***"skipped" is a dummy variable for whether subjects skip the question that asks their religion. If they skip this question, we drop them from the sample 
***and if not, we assign a dummy variable to indicate the treatment group (religion salient or control) that subject belongs to.
gen skipped=0
replace skipped=1 if  s10q15==""
gen treatR=.
replace treatR=religion if skipped==0
drop if skipped==1

***Define religion
gen relig=.

***Note: 1 = protestant or other christian, 2 = catholic, 3 = jewish, 4 = agnostic/atheist
replace relig=1 if (s10q15=="Christian - Other (please specify below)" | s10q15=="Christian - Protestant (please specify denomination below)")
replace relig=2 if s10q15=="Christian - Catholic"
replace relig=3 if s10q15=="Jewish (Orthodox/Reformed/etc.)" | s10q15=="Jewish (Orthodox/Reform/etc.)"
replace relig=4 if (s10q15=="Agnostic" | s10q15=="Atheist")

***Drop Mormon/Othodox Christians from the sample
drop if s10q15sp == "Greek Orthodox"
drop if s10q15sp == "Russian Othrodox"
drop if s10q15sp == "greek orthodox"
drop if s10q15sp == "Orthodox Christian"
drop if s10q15sp == "Greek Orthdox"
drop if s10q15sp == "christian orthodox"
drop if s10q15sp == "Greek Orthodox Christian"
drop if s10q15sp == "Russian orthodox"
drop if s10q15sp == "Church of Jesus Christ of Latter Day Saints"
drop if s10q15sp == "Greek Orthodox"

// End of variables

***Drop those subjects who don't take part in the risk preference section
drop if s3q1 == .

***Generate upper limit for risk with small amounts
gen risk1=.
replace risk1=(1.6*0.5-1) if s3q1==1
gen risk2=.
replace risk2=(2*0.5-1) if s3q2==1
gen risk3=.
replace risk3=(2.4*0.5-1) if s3q3==1
gen risk4=.
replace risk4=(2.8*0.5-1) if s3q4==1
gen risk5=.
replace risk5=(3.2*0.5-1) if s3q5==1
gen risk6=.
replace risk6=(3.6*0.5-1) if s3q6==1

***Choose the upper limit for the first time a subject chooses the risky asset with small amounts.
gen reservationrisk1= min(risk1,risk2,risk3,risk4,risk5,risk6)

***Generate upper limit for risk with large amounts
gen risk7=.
replace risk7=(160*0.5-100)/100 if s4q1==1
gen risk8=.
replace risk8=(200*0.5-100)/100 if s4q2==1
gen risk9=.
replace risk9=(240*0.5-100)/100 if s4q3==1
gen risk10=.
replace risk10=(280*0.5-100)/100 if s4q4==1
gen risk11=.
replace risk11=(320*0.5-100)/100 if s4q5==1
gen risk12=.
replace risk12=(360*0.5-100)/100 if s4q6==1

***Choose the upper limit for the first time a subject chooses the risky asset with large amounts.
gen reservationrisk2= min(risk7,risk8,risk9,risk10,risk11,risk12)

***Create two entries per subject. One is for small amounts and the other is for large amounts. riskchoice indicates whether it is a small or large stake gamble. 
reshape long reservationrisk, i(id) j(riskchoice)

***largestake is a dummy where a 1 indicates risk choices with large amounts and a 0 indicates risk choices with small amounts.
gen largestake=0
replace largestake= 1 if riskchoice==2 

***Recall reservationrisk indicates the upper limit. Rename this variable risku and create another variable, riskl, which will indicate the lower limit.
rename reservationrisk risk
gen riskl=.
gen risku=risk

***Fill in values for the lower limit.
***Note that even if someone always chose the safe option, they are assigned a missing value for the upper limit and the highest possible value we ask about for the lower limit. So they are properly taken care of.
replace riskl=. if risk < -.2
replace riskl=(1.6*0.5-1) if risk == 0
replace riskl=(2*0.5-1) if risk > .1 & risk < .3
replace riskl=(2.4*0.5-1) if risk > .3 & risk < .5
replace riskl=(2.8*0.5-1) if risk > .5 & risk < .7
replace riskl=(3.2*0.5-1) if risk > .7 & risk < .9
replace riskl=(3.6*0.5-1) if risk == . & s4q1 ~= .

***Panel D
intreg riskl risku treatR largestake if relig==1, cluster(id)

intreg riskl risku treatR largestake if relig==2, cluster(id)

clear all
set mem 30m
set more off

use "/Users/gwf25/Dropbox/research/religion/final code/religion_all.dta"

//  Begin definition of variables

***Drop subjects who thought the experiment was about religion
gen id = _n
drop if id == 98 | id == 176 | id == 194 | id == 383

***Drop subjects who incorrectly completed the priming task. This includes subjects who leave more than half the responses blank. The following subjects
***all left at least questions #2-#7 blank in the sentence unscrambling task. 
drop if id==7 | id==719 | id==740 | id==762 | id==940

***An error led to some subjects seeing both the control and religion salient sentence unscrambling tasks. Here, we drop those subjects.
drop if prime_diff == 1

***"skipped" is a dummy variable for whether subjects skip the question that asks their religion. If they skip this question, we drop them from the sample 
***and if not, we assign a dummy variable to indicate the treatment group (religion salient or control) that subject belongs to.
gen skipped=0
replace skipped=1 if  s10q15==""
gen treatR=.
replace treatR=religion if skipped==0
drop if skipped==1

***Define religion
gen relig=.

***Note: 1 = protestant or other christian, 2 = catholic, 3 = jewish, 4 = agnostic/atheist
replace relig=1 if (s10q15=="Christian - Other (please specify below)" | s10q15=="Christian - Protestant (please specify denomination below)")
replace relig=2 if s10q15=="Christian - Catholic"
replace relig=3 if s10q15=="Jewish (Orthodox/Reformed/etc.)" | s10q15=="Jewish (Orthodox/Reform/etc.)"
replace relig=4 if (s10q15=="Agnostic" | s10q15=="Atheist")

***Drop Mormon/Othodox Christians from the sample
drop if s10q15sp == "Greek Orthodox"
drop if s10q15sp == "Russian Othrodox"
drop if s10q15sp == "greek orthodox"
drop if s10q15sp == "Orthodox Christian"
drop if s10q15sp == "Greek Orthdox"
drop if s10q15sp == "christian orthodox"
drop if s10q15sp == "Greek Orthodox Christian"
drop if s10q15sp == "Russian orthodox"
drop if s10q15sp == "Church of Jesus Christ of Latter Day Saints"
drop if s10q15sp == "Greek Orthodox"

// End of variables


***Drop those subjects who don't take part in the time preference section
drop if s2q1 == .

***Create the upper limit of the discount rate.
//gen r1=.
//replace r1= ln(ln(10.10/10)) if s2q1==1
//gen r2=.
//replace r2= ln(ln(10.25/10)) if s2q2==1
//gen r3=.
//replace r3= ln(ln(10.50/10)) if s2q3==1
//gen r4=.
//replace r4= ln(ln(10.75/10)) if s2q4==1
//gen r5=.
//replace r5= ln(ln(11/10)) if s2q5==1
//gen r6=.
//replace r6= ln(ln(11.25/10)) if s2q6==1
//gen r7=.
//replace r7= ln(ln(11.50/10)) if s2q7==1
//gen r8=.
//replace r8= ln(ln(12/10)) if s2q8==1
//gen r9=.
//replace r9= ln(ln(12.50/10)) if s2q9==1
//gen r10=.
//replace r10= ln(ln(13/10)) if s2q10==1
//gen r11=.
//replace r11= ln(ln(14/10)) if s2q11==1
//gen r12=.
//replace r12= ln(ln(15/10)) if s2q12==1

***Fill in the upper limit, rounding to 7 decimal places for now vs. 1 week choices.
gen r1=.
replace r1= -4.6101495 if s2q1==1
gen r2=.
replace r2= -3.7012512 if s2q2==1
gen r3=.
replace r3= -3.0202265 if s2q3==1
gen r4=.
replace r4= -2.6266454 if s2q4==1
gen r5=.
replace r5= -2.3506187 if s2q5==1
gen r6=.
replace r6= -2.1389110  if s2q6==1
gen r7=.
replace r7= -1.9678147 if s2q7==1
gen r8=.
replace r8= -1.7019834 if s2q8==1
gen r9=.
replace r9= -1.4999400 if s2q9==1
gen r10=.
replace r10= -1.3380214 if s2q10==1
gen r11=.
replace r11= -1.0892396 if s2q11==1
gen r12=.
replace r12= -0.9027205 if s2q12==1

***Choose the upper limit for the first time the subject makes the patient choice in the now vs. 1 week section.
gen reservationr1= min(r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12)

***Note that the number of missing observations for s2q1 through s2q24 (for those subjects who completed participated in the time section) is always zero.

***Fill in the upper limit, rounding to 7 decimal places for 1 week vs. 2 week choices.
gen r13=.
replace r13=-4.6101495 if s2q13==1
gen r14=.
replace r14= -3.7012512 if s2q14==1
gen r15=.
replace r15= -3.0202265 if s2q15==1
gen r16=.
replace r16= -2.6266454 if s2q16==1
gen r17=.
replace r17= -2.3506187 if s2q17==1
gen r18=.
replace r18= -2.1389110 if s2q18==1
gen r19=.
replace r19= -1.9678147 if s2q19==1
gen r20=.
replace r20= -1.7019834 if s2q20==1
gen r21=.
replace r21= -1.4999400 if s2q21==1
gen r22=.
replace r22= -1.3380214 if s2q22==1
gen r23=.
replace r23= -1.0892396 if s2q23==1
gen r24=.
replace r24= -0.9027205 if s2q24==1

***Choose the upper limit for the first time the subject makes the patient choice in the 1 week vs. 2 week section.
gen reservationr2=min(r13,r14,r15,r16,r17,r18,r19,r20,r21,r22,r23, r24)

***Create two observations per subject where reservationr is the upper limit of the discount rate and timechoice indicates whether the choice was between now vs. 1 week or 1 week vs. 2 weeks.
reshape long reservationr, i(id) j(timechoice)

***Create the dummy variable week1 that takes the value 1 when the choice was between 1 week vs. 2 weeks and 0 when the choice was between now vs. 1 week.
gen week1=0
replace week1 = 1 if timechoice==2 

***Recall that reservationr represents the upper limit of the discount rate. Rename this rate and then create two variables, ratel and rateu, that represent the lower and upper values for the discount rate, respectively.
rename reservationr rate
gen ratel=.
gen rateu= rate

***Fill in the values for ratel, the lower value for the discount rate.
***Note that log(x) returns the natural log of ln(x) 
//replace ratel=. if rate==log(log(10.10/10))
//replace ratel= log(log(10.10/10)) if rate==log(log(10.25/10))
//replace ratel= log(log(10.25/10)) if rate==log(log(10.5/10))
//replace ratel= log(log(10.5/10)) if rate==log(log(10.75/10))
//replace ratel= log(log(10.75/10)) if rate==log(log(11/10))
//replace ratel= log(log(11/10)) if rate==log(log(11.25/10))
//replace ratel= log(log(11.25/10)) if rate==log(log(11.50/10))
//replace ratel= log(log(11.50/10)) if rate==log(log(12/10))
//replace ratel= log(log(12/10)) if rate==log(log(12.5/10))
//replace ratel= log(log(12.5/10)) if rate==log(log(13/10))
//replace ratel= log(log(13/10)) if rate==log(log(14/10))
//replace ratel= log(log(14/10)) if rate==log(log(15/10))
//replace ratel= log(log(15/10)) if rate==.

***Fill in values for ratel, rounding to 7 decimal places
***Note that the last line takes care of those who always make the impatient choice because their discount rate lies between the highest we ask about and "."
replace ratel=. if rateu < -4.61
replace ratel= -4.6101494 if rateu < -3.7 & rateu > -4.61
replace ratel= -3.7012513 if rateu < -3.02 & rateu > -3.7
replace ratel= -3.0202265 if rateu < -2.62 & rateu > -3.02
replace ratel= -2.6266454 if rateu < -2.35 & rateu > -2.62
replace ratel= -2.3506187 if rateu < -2.13 & rateu > -2.35
replace ratel= -2.1389110  if rateu < -1.96 & rateu > -2.13
replace ratel= -1.9678147  if rateu < -1.70 & rateu > -1.96
replace ratel= -1.7019834  if rateu < -1.49 & rateu > -1.70
replace ratel= -1.4999400  if rateu < -1.33 & rateu > -1.49
replace ratel= -1.3380214  if rateu < -1.08 & rateu > -1.33
replace ratel= -1.0892396  if rateu < -0.90 & rateu > -1.08
replace ratel= -0.9027205 if rateu==.

***Panel E
intreg ratel rateu treatR week1 if relig==1, cluster(id)

intreg ratel rateu treatR week1 if relig==2, cluster(id)

clear all
set mem 30m
set more off

use "/Users/gwf25/Dropbox/research/religion/final code/religion_all.dta"

//  Begin definition of variables

***Drop subjects who thought the experiment was about religion
gen id = _n
drop if id == 98 | id == 176 | id == 194 | id == 383

***Drop subjects who incorrectly completed the priming task. This includes subjects who leave more than half the responses blank. The following subjects
***all left at least questions #2-#7 blank in the sentence unscrambling task. 
drop if id==7 | id==719 | id==740 | id==762 | id==940

***An error led to some subjects seeing both the control and religion salient sentence unscrambling tasks. Here, we drop those subjects.
drop if prime_diff == 1

***"skipped" is a dummy variable for whether subjects skip the question that asks their religion. If they skip this question, we drop them from the sample 
***and if not, we assign a dummy variable to indicate the treatment group (religion salient or control) that subject belongs to.
gen skipped=0
replace skipped=1 if  s10q15==""
gen treatR=.
replace treatR=religion if skipped==0
drop if skipped==1

***Define religion
gen relig=.

***Note: 1 = protestant or other christian, 2 = catholic, 3 = jewish, 4 = agnostic/atheist
replace relig=1 if (s10q15=="Christian - Other (please specify below)" | s10q15=="Christian - Protestant (please specify denomination below)")
replace relig=2 if s10q15=="Christian - Catholic"
replace relig=3 if s10q15=="Jewish (Orthodox/Reformed/etc.)" | s10q15=="Jewish (Orthodox/Reform/etc.)"
replace relig=4 if (s10q15=="Agnostic" | s10q15=="Atheist")

***Drop Mormon/Othodox Christians from the sample
drop if s10q15sp == "Greek Orthodox"
drop if s10q15sp == "Russian Othrodox"
drop if s10q15sp == "greek orthodox"
drop if s10q15sp == "Orthodox Christian"
drop if s10q15sp == "Greek Orthdox"
drop if s10q15sp == "christian orthodox"
drop if s10q15sp == "Greek Orthodox Christian"
drop if s10q15sp == "Russian orthodox"
drop if s10q15sp == "Church of Jesus Christ of Latter Day Saints"
drop if s10q15sp == "Greek Orthodox"

// End of variables

rename s5 giveaway

*** Panel F
reg giveaway treatR if relig == 1, r
reg giveaway treatR if relig == 2, r

clear all
set mem 30m
set more off

use "/Users/gwf25/Dropbox/research/religion/final code/religion_all.dta"

//  Begin definition of variables

***Drop subjects who thought the experiment was about religion
gen id = _n
drop if id == 98 | id == 176 | id == 194 | id == 383

***Drop subjects who incorrectly completed the priming task. This includes subjects who leave more than half the responses blank. The following subjects
***all left at least questions #2-#7 blank in the sentence unscrambling task. 
drop if id==7 | id==719 | id==740 | id==762 | id==940

***An error led to some subjects seeing both the control and religion salient sentence unscrambling tasks. Here, we drop those subjects.
drop if prime_diff == 1

***"skipped" is a dummy variable for whether subjects skip the question that asks their religion. If they skip this question, we drop them from the sample 
***and if not, we assign a dummy variable to indicate the treatment group (religion salient or control) that subject belongs to.
gen skipped=0
replace skipped=1 if  s10q15==""
gen treatR=.
replace treatR=religion if skipped==0
drop if skipped==1

***Define religion
gen relig=.

***Note: 1 = protestant or other christian, 2 = catholic, 3 = jewish, 4 = agnostic/atheist
replace relig=1 if (s10q15=="Christian - Other (please specify below)" | s10q15=="Christian - Protestant (please specify denomination below)")
replace relig=2 if s10q15=="Christian - Catholic"
replace relig=3 if s10q15=="Jewish (Orthodox/Reformed/etc.)" | s10q15=="Jewish (Orthodox/Reform/etc.)"
replace relig=4 if (s10q15=="Agnostic" | s10q15=="Atheist")

***Drop Mormon/Othodox Christians from the sample
drop if s10q15sp == "Greek Orthodox"
drop if s10q15sp == "Russian Othrodox"
drop if s10q15sp == "greek orthodox"
drop if s10q15sp == "Orthodox Christian"
drop if s10q15sp == "Greek Orthdox"
drop if s10q15sp == "christian orthodox"
drop if s10q15sp == "Greek Orthodox Christian"
drop if s10q15sp == "Russian orthodox"
drop if s10q15sp == "Church of Jesus Christ of Latter Day Saints"
drop if s10q15sp == "Greek Orthodox"

// End of variables

*** Panel G
reg anagramsattempted treatR if relig == 1, r
reg anagramsattempted treatR if relig == 2, r

clear all
set mem 50m
set more off

use "/Users/gwf25/Dropbox/research/religion/final code/religion_all.dta"

//  Begin definition of variables

***Drop subjects who thought the experiment was about religion
gen id = _n
drop if id == 98 | id == 176 | id == 194 | id == 383

***Drop subjects who incorrectly completed the priming task. This includes subjects who leave more than half the responses blank. The following subjects
***all left at least questions #2-#7 blank in the sentence unscrambling task. 
drop if id==7 | id==719 | id==740 | id==762 | id==940

***An error led to some subjects seeing both the control and religion salient sentence unscrambling tasks. Here, we drop those subjects.
drop if prime_diff == 1

***"skipped" is a dummy variable for whether subjects skip the question that asks their religion. If they skip this question, we drop them from the sample 
***and if not, we assign a dummy variable to indicate the treatment group (religion salient or control) that subject belongs to.
gen skipped=0
replace skipped=1 if  s10q15==""
gen treatR=.
replace treatR=religion if skipped==0
drop if skipped==1

***Define religion
gen relig=.

***Note: 1 = protestant or other christian, 2 = catholic, 3 = jewish, 4 = agnostic/atheist
replace relig=1 if (s10q15=="Christian - Other (please specify below)" | s10q15=="Christian - Protestant (please specify denomination below)")
replace relig=2 if s10q15=="Christian - Catholic"
replace relig=3 if s10q15=="Jewish (Orthodox/Reformed/etc.)" | s10q15=="Jewish (Orthodox/Reform/etc.)"
replace relig=4 if (s10q15=="Agnostic" | s10q15=="Atheist")

***Drop Mormon/Othodox Christians from the sample
drop if s10q15sp == "Greek Orthodox"
drop if s10q15sp == "Russian Othrodox"
drop if s10q15sp == "greek orthodox"
drop if s10q15sp == "Orthodox Christian"
drop if s10q15sp == "Greek Orthdox"
drop if s10q15sp == "christian orthodox"
drop if s10q15sp == "Greek Orthodox Christian"
drop if s10q15sp == "Russian orthodox"
drop if s10q15sp == "Church of Jesus Christ of Latter Day Saints"
drop if s10q15sp == "Greek Orthodox"

drop id
// End of variables


rename m wageoffer

***Panel I
reg wageoffer treatR if relig == 1, r
reg wageoffer treatR if relig == 2, r


***Create the cost, cXXX, for providing a certain amount of effort at eXXX. A certain monetary cost is associated with each level of output. So, we have:
***[eXXX, cXXX] = [(1,$0.00),(2,$0.04),(3,$0.08),(4,$0.16),(5,$0.24),(6,$0.32),(7,$0.40),(8,$0.48),(9,$0.60),(10,$0.72)]
gen c000 = .
replace c000 = 0 if e000 == 1
replace c000 = .04 if e000 == 2
replace c000 = .08 if e000 == 3
replace c000 = .16 if e000 == 4
replace c000 = .24 if e000 == 5
replace c000 = .32 if e000 == 6
replace c000 = .40 if e000 == 7
replace c000 = .48 if e000 == 8
replace c000 = .60 if e000 == 9
replace c000 = .72 if e000 == 10

gen c050 = .
replace c050 = 0 if e050 == 1
replace c050 = .04 if e050 == 2
replace c050 = .08 if e050 == 3
replace c050 = .16 if e050 == 4
replace c050 = .24 if e050 == 5
replace c050 = .32 if e050 == 6
replace c050 = .40 if e050 == 7
replace c050 = .48 if e050 == 8
replace c050 = .60 if e050 == 9
replace c050 = .72 if e050 == 10

gen c100 = .
replace c100 = 0 if e100 == 1
replace c100 = .04 if e100 == 2
replace c100 = .08 if e100 == 3
replace c100 = .16 if e100 == 4
replace c100 = .24 if e100 == 5
replace c100 = .32 if e100 == 6
replace c100 = .40 if e100 == 7
replace c100 = .48 if e100 == 8
replace c100 = .60 if e100 == 9
replace c100 = .72 if e100 == 10

gen c150 = .
replace c150 = 0 if e150 == 1
replace c150 = .04 if e150 == 2
replace c150 = .08 if e150 == 3
replace c150 = .16 if e150 == 4
replace c150 = .24 if e150 == 5
replace c150 = .32 if e150 == 6
replace c150 = .40 if e150 == 7
replace c150 = .48 if e150 == 8
replace c150 = .60 if e150 == 9
replace c150 = .72 if e150 == 10

gen c200 = .
replace c200 = 0 if e200 == 1
replace c200 = .04 if e200 == 2
replace c200 = .08 if e200 == 3
replace c200 = .16 if e200 == 4
replace c200 = .24 if e200 == 5
replace c200 = .32 if e200 == 6
replace c200 = .40 if e200 == 7
replace c200 = .48 if e200 == 8
replace c200 = .60 if e200 == 9
replace c200 = .72 if e200 == 10

gen c250 = .
replace c250 = 0 if e250 == 1
replace c250 = .04 if e250 == 2
replace c250 = .08 if e250 == 3
replace c250 = .16 if e250 == 4
replace c250 = .24 if e250 == 5
replace c250 = .32 if e250 == 6
replace c250 = .40 if e250 == 7
replace c250 = .48 if e250 == 8
replace c250 = .60 if e250 == 9
replace c250 = .72 if e250 == 10

gen c300 = .
replace c300 = 0 if e300 == 1
replace c300 = .04 if e300 == 2
replace c300 = .08 if e300 == 3
replace c300 = .16 if e300 == 4
replace c300 = .24 if e300 == 5
replace c300 = .32 if e300 == 6
replace c300 = .40 if e300 == 7
replace c300 = .48 if e300 == 8
replace c300 = .60 if e300 == 9
replace c300 = .72 if e300 == 10

gen c350 = .
replace c350 = 0 if e350 == 1
replace c350 = .04 if e350 == 2
replace c350 = .08 if e350 == 3
replace c350 = .16 if e350 == 4
replace c350 = .24 if e350 == 5
replace c350 = .32 if e350 == 6
replace c350 = .40 if e350 == 7
replace c350 = .48 if e350 == 8
replace c350 = .60 if e350 == 9
replace c350 = .72 if e350 == 10

gen c400 = .
replace c400 = 0 if e400 == 1
replace c400 = .04 if e400 == 2
replace c400 = .08 if e400 == 3
replace c400 = .16 if e400 == 4
replace c400 = .24 if e400 == 5
replace c400 = .32 if e400 == 6
replace c400 = .40 if e400 == 7
replace c400 = .48 if e400 == 8
replace c400 = .60 if e400 == 9
replace c400 = .72 if e400 == 10

***Drop the highest effort amount
drop c400

***In order to properly reshape the data, we must rename the effort and cost of effort at $0 and $0.50
rename e000 e0
rename e050 e50
rename c000 c0
rename c050 c50

***Create the corresponding wages for each effort choice
gen w0 = 0
gen w50 = .5
gen w100 = 1
gen w150 = 1.5
gen w200 = 2
gen w250 = 2.5
gen w300 = 3
gen w350 = 3.5

***Create the estimated regression parameter where beta=reciprocity
gen beta=.

gen id = _n

***Reshape the data so that we can regress cost of effort on all possible wages, by subject
reshape long c, i(id) j(w)

***Loop through all subjects and regress the effort on wage by each subject and save values of regression
***Note that some subjects did not do this section so we exclude them here. Only subjects numbered 263 through 689 did the gift exchange task.
quiet forvalues x = 263/689 {
reg c w if id ==`x'
replace beta=_b[w] if id ==`x'
}

***Reshape the data to its original form
reshape wide c, i(id) j(w)

***Panel H
***Note: remember to multiply point estimates and standard errors by 100 to get the value in dollars. This scaling is a result of wages being displayed in cents and not dollars. 
reg beta treatR if relig == 1, r
reg beta treatR if relig == 2, r
